minor speed improvments