Added missing override annotation, removed unused imports and variables, some other minor refactoring.