fsm iniital code for david