Refactoring, added JSONP capability