Added nested function, still incomplete program