I was a little wary of returning shared_ptrs by value but some research indicates that this is in fact a reasonable thing to do. Updated!