moved some functionality from app.js to sites.js