Changed grids to ko.Grids and cleaned code