Minor Tidy Up

Sensible variable names

Functions ordered according to call order

Signed-off-by: James Piggles <jack@homeflow.co.uk>