fixes to allow events to show in calendar and refactoring