Add tables generator, fix errors