support -h parameter, and refactored Main.java