Update: I add some basic error checking in my function calls