Finished coding

I wrote all the functions and the code works for his two examples (from
what I could tell). More thorough testing still needs to be done.