Optimised code heavily. Compiled file size reduced by >50%.