working with custom sorting functions