some changes from kupol - 3
some changes from kupol - 4 pullrequests