Tested and fixed sorting
added stuff