started refactoring code and code cleanup.

Network features now... work.