Finally figured out what I was doing wrong. Also added check for v paramater to indicate verbose mode.