Refined tern code, solved the underscore problem.