[fix] Errors and logic. Remove console logs.

Restore original logic for topVisible, fix errors, remove console.log's.