Fixed bug in replacing comparisons of strings with values
Tidying
Couple more examples of edge cases