[BACKLOG-207] - Refactoring and unit testing