moved setting overlay grid size and buttons to separate function