Fix formatting rules

Formatting rules should now work as expected.

Couple of issues - using the wrong variable (whoops), and casting to int breaking other reuls (such as bools)