Refactor commons/js/