some changes from Aleksey and me