updted to use internal q