Merged the changes from nemethf