Fixed resizing issue
Expanded out lambdas in the first example to be more explicit in the the types