Added option parser and more writing