Smarter Algorithm