Finally made the writer query work