more functions and tests