Separate logic for initialization and replacement