rework'd the if statement