fixed a typo, added as.vector
added two indexing functions