Refactoring as per peer reviews and fix issue coming from conflict resolution