re-structure IF statement