major initial commit of all major functions from the ipython notebook