Total rewrite of the overlay visibility and location handling + cleanup