adding average signal length calculation
-fixing bugs