Added pattern handling and url parsing