Completed using plyr