added comments and missing const