Added docs and comments