Nested Functions and passing Functions as arguments