Removed unused code and imports. Fixed java warnings.