Grid updated, small code refactoring