Changed Table from singleton to function