moving main function to separate file