break apart directories, fix self ref
fix temporary directory choice, enable logging