refactoring, move op to front. fix a bug. the control flow with branches is still not correct.