add filtering for days
minor refactorings
added timerange query