Code fixes and commentaries