Added many small fixes and comments.