split main into separate file