Global refactoring, introduce more comment, centralize the management of deviceHeader, delete some useless files