Split out code into different files, and implemented multiple return values.