Refactored the Layout module for the deep embedding.