Cleaning up and caching the table in memory