[CHEF-2821] simplified and with tests