better error handling and such