Added error checking.
Put preferences block in its own grid.