csv writing works, still needs bugfixing & proper testing