Add the function to find median value Fixes #3