Move hot-swap.js code into core.js