cleaned up globals
cleaned up server data sending logic