Added a minor logic change