vjr debugging, refactoring, minor tweaks