rewrite base controller again

This time search for the id of the target. If no target id is given
then search for the first parent.