Moved functionality from main to get_webpage