copied v0.2.1 from subversion trunk