optimized Main