removed echo
better logic