Refactored login in index.

Fixed issues with index page