Refactor for readability and less code. No breaking changes made.