hydra tidy up and error check