more testing and tweaking towards new project, and some basic refactoring