refactor USB protocol