Add foreign key constraints and change tables engine - issue #20