nested function calls and testing