Cleaned up range finder code (added documentation)