Cleaned Up Code and started the 'network loop'