Initial refactoring code dump

[ci skip]