Added condition checks