Reordered functions
Added support for global aliases and code simplification