added errors and error checking methods in Main class