Add median and unit tests for all