major progress on main method; added some errors; expanded on error functions