working sorting algorithm and "append" to html