Refactored code for readability.

 - Added documentation to the critical parts (relayMessage &
	socketListener)
 - Broke all the IO related parts into seperate handler files
 - Updated the type signatures
update README