major changes to make pkg work