Add device struct
Remove unused code
Add protocol registration mechanism