improving if conditions