added several features to speed up