Some initial work on IF and a bug fix.