Optimize lab1-6
More work on exercises3