Redesign the layout and clean up JS code