Refactored Common.js