first engine code completed, need improvment and test