Refactor server <-> resource layer. Add integration tests. Add logging
Tidy up indenation and whitespace, add documentation to the README