faster with extra checks