refactored 6 a bit