Updated with new utilities. Now supports timeout.