use the `inreplace` helper function for this instead?