Big restructuration for extensibility, added several helper methods to generate the database tables