added some error handling, and some authentication filters