adding functionality for automatic determiantion of grid and block size