New functions and tests