Refactor references