Code from version 2.0RC6