Adds main method to run from command line.