Seems to work now!
Adding command line parameter handling