Adding doc blocks and appropriate comments