Refactored into functions, accepts thread url as console input