Implement sort and restoring recent position.