Added timeout to requests and other minor fixes