Formatting
Code factoring
Added missing dirty flags
Small font tweaks