reformatted test code into lambda functions