optimized some scripts