Added extra documentation and comments.