Improved parsing rules.
Added UI logic.