Added support for libraries

Included test cases for coverage

I think we're missing at least a few test:

1. `id` supercedes `appID`.
1. `appID` is used when `id` is absent
1. `lib` function writes to `/libs/...` path

Also, the tests should use `id` instead of `appID` except when specifically testing `appID` (as in the first two items in the list above).