fix errors and complete coding