add some more options and file writing stuff