First pass at implementing threads and sockets