Optimized getFirstVisibleItem + other optimisations