Refactored em*.js to common.js