Code review.

Bit of refractoring, removed some pointless variables and tidied up the
code.