Refactor arguments to take a type enum, add documentation, use int. Token types

Uh, playing with this on the plane ride so kind of a big commit.