Replace procedural nested array functions: https://drupal.org/node/1870678