working code but incomplete