Add documentation and fix indentation