Full commented version