added lambda but with some bugs