Add comments and improve code formatting
Fix code format
Unregister name on receiver close