restructured, added Raphael scaling support