Fixed to be smarter