this is really difficult to follow. can you break this up into separate replaceElFulfilled/replaceElRejected functions?