removed an unnecessary function, refactored to lambda