Add data functions and tests