added a main method and parameter handling.