Merge back to the trunk.

Refactoring done (Removed network related stuff), merge back to the trunk.