changed sorting and other various changes