added some logging stuff, improved subscription query