Misc cleanup of the code. Added text as an attribute.