moved to new method of keeping functions in lib, and this allows for testing