Applying your new coding skills to a State Machine