Moving helpers to module file
Adding tests and fix for test fails