Optimized
Implement lab2