Refactored and added insertion sort