simplifying string/list range logic