refactoried again