add the bonus sorting code