more refactorings but no luck yet