updates to pkgng module

I tried to break this into three parts for clarity: standardization (b1911dd), updating existing functions (8b962a1) and adding new functions (2ffd0a0). I goofed somewhere along the line and that merge ended up in there. Hopefully that isn't too big of a problem. If it is please let me know and I'll try this again.