making some small changes to authentication code, still not working completely