Initial version of functions and tests