Added puts and console.logs to explain the process.