CSPACE-5728: Internal refactoring to split a large method into multiple, smaller and more focused methods.