fix indentation
improve relation handling