added working code up to date
working code up to date