modified to work for both 2.0.0 and 2.1.1