add demo function and tests