Implemented login and a lot of page refactoring