added comments and clean up some formats