improved indent, error message if no root found
refactoring
added error message if object could not be found

prevents „segmentation fault“