Added basic filtering for events

Added basic filtering for events plus some other changes that are not
so important