some algo changes