added some grid operations
corrected some functions