several changes: code cleanups, minor improvements