added working code as of 22 Apr