Small restructure of code.