Refactors layout code again
Refactors layout code again