smart algorithm added