Refine implementation of #2.
Working snapshot.
Fixed #68.