put all checks and json logic in url callback