Fully working hydra emulation script completed