Split main into two files