A few changes to if implementation