added option to stop search when it's taking too long