Move main between types and funcs