cleanup, using templates