not 100% debuged code

2nd variant of 5th lab