Tests passing, function interface needs to be safer