Sixth working version: all outputs working properly