refactoring of function names and bug fix in index.lp