incorporate changes from Sorin's repo