Added events for database row added, updated and removed and made various bug fixes, improvements and refactoring