Refactored login and introduced registration feature