Refactor prev and next entry boxes