minor tweeks and changes, started the refactoring