Refactor ordering into a module