Reorganizing
tested and working version of socket module.