removed detectEncoding and plyr dependency