refactored a bit
refactored a bit more