Added more docs and comments