refactor prev()