[BUGFIX] Refactoring of CardLayout.js