added stuff to error handling I guess