Most of the related functions are now class methods in a dedicated file.
Refactoring continues. This update moves some of the replication manipulation functions to a separate file and turns them into class methods.