Modifications to authentication and refactoring of some hibernate files.