Common functions are ported, some complex allocation logic should be
checked.