Move layouts to their own file; unroll scan_row loop.