Added CallWithTimeout method taken wholesale from a Stackoverflow question.