drawing functionality for grid based ui