error resolved - working code