Added code for executeSort