Improved Q logic