Edited to allow args from terminal to define min/max