Move main code to package