added as.data.frame cleaned some comments