completion of the third tutorial with proper comments