Document fix and code cleaning