partial code for version 2.1