Refactored and modularized CSS and fixed a race condition bug in a RequireJS module