refactor it and make it working without jsonp