Adding error handling, that I'm so far very unhappy with.