Finally works
Two versions
Perfect version