Add grid support
Revise grid python file