Responsive Layout Grid Refactored

The layout process has been split into two phases - a config phase and a
layout phase. This should make layout faster, since the configuration
part is only carried out once, and not for each layout process.