Refactorig to improve readability