getting Enej's changes

Not tested change.