More rules

Some if/then/else additions. And also a change in line number handling as we discussed earlier.