Finally I think I got this working.