i had to refactor my code