split main code in separate files