Allowed for q to be empty.