Made timeout possible to send in as an argument.