commented visibility algorithm