Handle selectedObject as object or callback proposed by @nekcih in #6