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.
Merge pull request #14 from Battlefy/fix/base-controller

rewrite base controller again