Updated sub and addapted to use red.app