adds monotonicity tests and some optimization to monotonicity tests