Refactoring - removedunused stuff and some renaming.