refactoring to more readable code