added P3 with lambda functions