Got timeout function working! Less suicidal!