[refact] build iot data in separate source module. Removed unused variables and added some comments.