fix sort and stuff

fixes stuff, sorry about the formatting sublime automatically did all that