refactoring into readable code