edit: updated with counter and clearing