cleaned up some code for mode controller;