Added a bunch of functions to work with arrays including sorting algorithm