Refactored wrapper to use factory logic.

- Moved files into lib/resources
- Init from lib/index.js
- Updated tests