Commented version with final changes