adds Prev/Next functionality for all classes.