moved bsearch and sorting functions to own file and fixed names in all other files