refactored _getNextRenderer and _getPreviousRenderer into a single
method.