Refactor world.js