added returnUri feature on suggestion of James