Add support for new stashes api

Also includes some things we had to fix along the way