Implementing Slava's solution regarding #259