Updated with timeout, and environment vars