added grid logic
fixed conflicts