cleanup and refactor
cs fixes
add doc blocks