Removing unused code and some cleanup.