adding checks and index