Add result handler & fix test run hanging bug