Various improvements, fixed/added comments.