introduced nestable resources, cleaned up code to use new Resource class, instance-level router