made PWM length filter logic as a function, increased refactoring.