Separated main functions into their own source files.

This will make it easier to test stuff by building our test runners with the full set of source files from each module.
Fixed failing tests with POTFILES.