Added more proper logic