Add and fix documentation
Avoid attribute shadowing and name variables more accurately
Remove unused import
Fix indentation