logics implementation
need be fixed