Fix callback URL, clean up code