added command pattern to invoke sorts