refactor insertionsort codebase