Implemented code to switch between logic states.