Moving rendering for states outside of the switch statement into functions