added $MAX_LEN counting max length for padding of final results