Median tests

pull request!