finish the code, but has warning, need to test