Added some error checking, did some ToDos