added a cleanup task, closes #314