added comments from original code