Look at a library called async which has some convenient utils for it