optimized some common steps