Added some logics.