Added provision for logging query factors