restructure + new package init (from StackOverflow)