Fixed an error in my logic.