Breaking visual/state change into separate fuctions