Add purge mechanism.
Fix prepareTable bug.

TODO: rewind.