added new logic. P.S. need to refactor.