impl free-cache. still buggy though, this branch finishes.