Made code comply better with Java best practices
Set member variables to final where applicable
Replaced broad catches with specific catches
Added appropriate annotations
Small optimisation fixes