added methods into index.js, need to move some basic error checking here