Refactored the Handler class a bit