update for 0.9.1; reorganized shared code