Improved speeds, stability and code structure