Fixed find*ByAttributes issue and applied minor optimizations.