restructure into a main+pkg