Refactored, improved networking

Need to replace firebase with something else. TCP connection not good
for real-time game.