merged from ademakov's repository