Update with possible improvement starting from master barnch