aadded test to utils module
Refactor and added tests