todo: replacement logic