factoring lab1 into different parts