Refactor debug module, device module and models to schemas
Add comments in core modules
Add more comments to code