Refactor
Add test cases for utility functions