This is a lot of code, better save now than sorry later when something gets deleted by mistake. Either way, the code will move later - once tested and organized properly - into its own package.