Proper refactor

After revisiting the refactor I did in december while trying to get it merged to the LW repo, I decided I wasn't happy with it and re-did the whole thing. Mostly so I could un-do my terrible, one-commit-for-everything mistake. Ended up making a few more changes than I anticipated, and wrote some basic documentation for once.