Add a layout system

Adapted from Dead Simple Grid (c) 2012 Vladimir Agafonkin