refactoring: remove Q from many functions