Added option to remove last state on state switch, updated input system.