nested functions now work