final changes - working code