added sorting. not working yet.