Rewriting the API to use a function for intervals, fixing bugs, adding more stuff to tutorial