Fixed layout definition ordering. Implemented promises to step through the recursive layout definition deletion.