A little refactor splitting code into two files.