Fixed whitespace and added documentation for $query_factory argument