Better thread handling in EmbeddedStorage