if statements optimized 2nd version