Code cleaning and layout fixes