Added auto-range function