The present paper contributes two novel techniques in the context of image restoration by nonlocal filtering. Firstly, we introduce an efficient implementation of the nonlocal means filter based on arranging the data in a cluster tree. The structuring of data allows for a fast and accurate preselection of similar patches. In contrast to previous approaches, the preselection is based on the same distance measure as used by the filter itself. It allows for large speedups, especially when the search for similar patches covers the whole image domain, i.e., when the filter is truly nonlocal. However, also in the windowed version of the filter, the cluster tree approach compares favorably to previous techniques in respect of quality versus computational cost. Secondly, we suggest an iterative version of the filter that is derived from a variational principle and is designed to yield non-trivial steady states. It reveals to be particularly useful in order to restore regular, textured patterns...