copied the old implementation from Portal for more fine grained control.  Closes GH-1