Improved logging
Refactored AND,OR filtering (OR takes precedence over AND), Fixed asc field
Upsert events.