cleanup: move initial script out of module
STY: partial cleanup, commented out code, fix some unused functions