reorganized to use google closure compiler. use javascript objects to hold attributes instead of an array of attribute objects. cleaned up.