working on sorting code