support for writing pcd
moved script stuff to main()