Pull the changes from Valery

Hello there,

Valery contributed with some improvements already requested in the past and also some bug fixing.
Would it be too much to ask to pull the changes into the main project?


Thank you!