improved implementation of findat