Changed to simplify variables and messing around with rules.
Fixed rule values as high priority given to low rule numbers and so we weren't firing correctly.
Merge branches 'working' and 'master'