Revert "Revert "Code Cleanup / Modularization""

This reverts commit 6ede2bfb4484984cae291bed6064e1ed6b43c714.