lots of comments and mem allocation fix