Javascript and layout fixes