Rewrite the SQLite database logic to be a lot easier to understand, read the documentation file for more information. Instead of two database tables for all three types (event, action and target) we now have three tables containing the required information for each type. Much easier to fill in and understand.