Formatting and fixed packet handling

Code formatted to look neater
Registered packet handler and channels