lab1 improve and simplify