q functions