Rewriting the inject method