Refactor grid to widget