Code clean up and capitalisation fixes