Documentation

    * Add documentation for easy understanding (all my future generations
      will thank me for this kindness)
    * Change some variable names to avoid confusion