Add comments and more merge tests
Add more tests
Refactor for clarity and consistency
refactor and add test cases
Refactoring for clarity