fixed bugs in most recent pkg version algorithm, added plyr as import for rbind.fill