better documentation, fix call to _.flatten