Improved CSS and JS behaviour