cleanup and error handling
removed dependency