Merged changes from other authors

Contributors: Sergey Ryabenko, Alexey Loginov