Rearranged code to use Lambda instead of loops...