complete code need debug