add a clear function (reverted from commit 7195d943070b4f5fdfbfd14a9a78484dae0e9ea9)