Improve object adding detection, cleanup

If you add controller to parent several times and controller's property
$auto_track_elements is true, then it will actually be initialized only
once.
Code cleanup