Update dynamic grid

Various bug fixes, including correcting media query relative sizes and various refactoring. Sync with latest version from Wonderflux.