refactored and tested the state object
refactored the network module so it doesnt rely on an object