Factoring out layout.hamlet, small fixes