Rewriting to use CSSOM where possible.
Fixing bug in which styles weren't being carried between changes.