Implemented resource manager.

Closes #32