Adding the ability to select page layouts, also some clean up and code formatting