remen's API rewrite

This is Hydra PR #305 rebased on to current master. Rebase was required due to recent merges that included new stages.

I have modified one commit (fa89563) to handle the changes to the API in these new stages.