cleaner code
change network code a bit