Reorganization and add '-p' option
Add '-N' flag for grid size argument