modified finding location function, has error function and time out