More code cleaning and layout optimizing