Changed the logic