Performance improved for line of sight algorithm and some cleanup.