Lab 4 logic and error