Improving the documentation

Adding an actual API reference - the examples on the page weren't good enough to make it clear how exactly to use it.