initial work, need better error handling
Merge pull request #41 from ischneider/smarter-layer-resource

initial work, need better error handling