refactoring: Moved authentication code into separate file