add lambda functions for threads