Slow code but finished