minor improvements for speed