Remove unnecessary endif
Change order in engine call