code refactor in objects search