refactored final conditional statement