Seperate main function into a single file.