Code cleanup

Fixes bug where missing address caused error
The code was looking for coordinates key being present, but didn’t care
if it was nil, which led to an error if it was.

Adds additional code documentation and removes unused code.