[#866] code refactor
Merge pull request #867 from akvo/issue/866-code-cleanup

[#866] code refactor