fix sorting function
adding a better render