Added comments and some error checking