Move main function from module definition layer