indentation, documentation and minors changes