slot[i].toString() is called multiple times here, consider saving it to a temporary variable. Also consider wrapping long lines around for readability.