added methods setMax(), advance()