Add documentation
Rename variables to be more sensible