tweaks and optimizations
major simplification of "visible_area" variable