added comments, and output