moved authentication outside of library