error handling and creating services