Refactored login page, addded comments and cleaned up code