refactoring of inline equation code to use more elegant x-link function