added url checker; made code more pythonic