Refactor translator out of main.