remove Raphael utility method calls and implement them locally + cleanup