Modify to support three levels deep