split main() into new file