Refactors shared/pattern.js into core/ and display/