Reformatted many funtions

-Made each grid placement easier to read
-Added more comments