start of something terrible
implemented error checking