Refactored to match the latest changes in core, refs https://github.com/zikula/core/pull/1407 and https://github.com/zikula/core/pull/1389, #1, closes #19.