clean up raphael code