Split main code into separate files