Solved conversion in a functional way