New layout generation (widgets), some code cleanup.