added functional interface and foreach test