Added sample writer