Move main code into a package.