Fixed comments; improved code efficiency