added comments and made output pipable