Added optional support for wrapping with Q (if q exists)