Lab 3 logic added to all three states