Refactor duplicated code in policies

Related to #39 and depends of #165.