working code.