added basic version to calculate grid width