reversed gem 'shuhari' implementation because it's not the focus of this commit.