Imported from manakai-core repository