docs and code cleanup