complete implement
but with a bug