Making some changes to the logic