refactoring lab1: