find function and some other improvements