Moved USB functions to it's own file and added generic code to for different device types