refactoring $qs