Documentation and Bugfixes

Fully documented the engine, fixed minor bugs, and clarified variable
names.