refactored/commented query refined