Better grid functionality

Cache `$('#grid')`, allow for different numbers of rows.