Redefined grid calculator to be better