Notes updated and code cleaning