Added commands and rewrited network code