Updated findBy logic & refactored code