refactoring in layout system
removed custom constructor
optimized and reduced garbage generated by layout function