optimised indent and changes to foreach

I started to take a look at Higgs and I like what I see! 
I'm not sure if you're open to pull requests, but I went through the code making a few tweaks for performance/idiomatic code. This is one of a few changes, I'll submit others if you are interested.

changes:

indent is now 2 to 3x faster when tested on real code . Almost certainly not an important optimisation, but every little helps.

unittest added for indent.

for loops are replaced by foreach (neater/more idiomatic).