YH-157: Reordered tasks and fixed return value