refactoring; depends on the unreleaed marmotta snapshot.