homework #2 completed with checkmarks and error handling