added a weighted median