removed some readlines and edited timeout code