working on error checking