Cleans up how layout code works, merging the code for simplicity