Cleaned up a bunch of the code. Made more modular. Also enabled TCP messages.