rewrote merge sort in pure functional style
added scala-like builders