added admin error handling and more code comments