Added the upstream function