basic median splitting working