firmware code cleanup