Removing unused code and tidying.