a bit modified about internal design