removed smallestNonZero function. added median and min functions. hardware still has trouble with purple led instead of red led when sleeping