refactored grid into a directive