added the code that I've written, but nothing is terribly well documented