CMS-2956 Refactor long methods part 1