added increasing/decreasing logic