refactor lab5