removes extra function, renames variables to nonmisleading names