Change grid logic