Add comments and fix jQuery function.