Headless apps update

code cleanup and bug fixes.
fixed the led counter in headlesserviceui not reaching 0.