working with functions and nested functions