Added sort function (merge sort) and code beautifucation