added some functions for authentication
added authentication to main