refactoring a bit

Creating a 'instances' and a 'instance/{instanceId}' endpoint for the
API.