Code cleaning.
Possible perfomance improvements (don't require the creation of tables where it isn't needed).