lab1.cpp is functionally correct, needs comments and perhaps
refactoring.