fixed stability criteria matching, added parameter for stability, stability now works as it's supposed to