Major overhaul. Used tmux instead of screen, added smarter wait functions etc.