source for session 5 - refactored grid