small refactoring for ability of improve query perfomance