Refactoring of CoAP