refactoring to improve readability and support ++