Javascript consolidation