Better implementation of If