Added tor related variables, reimplemented socks operations to avoid multiple connections to tor control port, added www prefix checks, added control socket termination