lab1: use conditional execution, but didn't improve the implementation