modified main to support dynamic parameters