Made grid its own directive. Put all grid related javascript into grid.js.