More tests, move private funcs to utils