Clean up doc blocks and add better comments