Can probably move `(key for own key of actions).length > 0` as the condition instead of creating `hasActions` variable