refactored grid drawing fn, made it a for loop