changed gridding to use median, fixing docstrings.