Cleaning up authentication, looking for bug