some major refactoring... getting rid of pthreads little by little
even more refactoring!
split up handshake process into a couple different functions, handling sending/receiving with select() now
added send_message, modified receive_message