completely fixed code