Added faster version using data.table for each function and png