added authentication
added error handling