Adding documentation and comments