Moved URL parser loop in one function