a smarter version