Adjusting logic flow to reduce number of conditional statements