Second variant - completed