Removed unused code and improved rake tasks.