restructured output and added comments