Updated to work with tabs