starting to handle errors slightly