basic authentication working, needs refactoring, don't understand the structure yet though