Package support that works on Android

Nicky's commits plus fixes.