intial code for overall system