Refactor - move column alias code to function