code from victor and tewodros

I added Tewodros' code to my branch via his pull request
I saw that Ketema sent a pull request before me so I manually merged his patch into my depot in the command line
Hopefully this will allow the unconflicted merging of mine and Tewodros' code whether this request is processed before or after Ketema's