Refactored Lab3