Simplify and factor qs handling