major refactor. add some scripts, update docs