Started work on allowing the max number to be set (incomplete)