Added error (404 and 500) handling and simple authentication