Added documentation and comments.