fixing bugs in attribute implementation
some minor refactoring, plus tidying and commenting existing Markup classes