Modified code to support vanilla 2.1