update by Alexander Yavorsky with my corrections