Made code more python3-like, added multiple page load attemps