Optimise some things.

Signed-off-by: Sam Phippen <samphippen@googlemail.com>
Formatting and more hacks

Signed-off-by: Sam Phippen <samphippen@googlemail.com>