added correct logic