Moved authentication to a separate class