working branch, minor fixes